<?php
/**
 * @Author: Marte
 * @Date:   2017-11-08 11:00:54
 * @Last Modified by:   Marte
 * @Last Modified time: 2017-11-09 13:13:33
 */
class wms_pdatooms_shippda {
	
   /**
     * 加入队列  自动确认和发货   第三方导入pda批量发货,通过物流单号进行确认
     * $_POST['api_data'] = "70276102440183,70276102440184,70276102440185";
     * $_POST['carno'] = "A98760";
     */
    function PDATOOMSbatchCheckAndDelivery($logi_no)
    {
        $ids = $logi_no;  //多批次
        $delivery_ids = explode(',', $ids);
        $delivery_ids = array_filter($delivery_ids);
        $logi_nums = array_unique($delivery_ids);

        if ( !$delivery_ids ) {
            return '快递单列表不能为空！';
        }
        $batch_number = count($delivery_ids);
        $bldata = array(
            'op_id' => 16777210, 
            'op_name' => 'system',
            'createtime' => time(),
            'batch_number' => $batch_number,
            'log_type' => 'checkandconsign',
//            'log_text'=>serialize($logi_nums),
            'log_text'=>serialize(array(
            'logi_no' => $logi_nums,
                // 'carno' => $carno,
            )),
        );
        $blObj = app::get('wms')->model('batch_log');
        $result = $blObj->save($bldata);
        //校验任务加队列
        $push_params = array(
            'data' => array(
                'log_text' => $bldata['log_text'],
                'log_id' => $bldata['log_id'],
                'task_type' => 'autochkanddly'
            ),
            'url' => kernel::openapi_url('openapi.autotask', 'service')
        );
        kernel::single('taskmgr_interface_connecter')->push($push_params);
	return '已提交至队列！';
    }
}
